package edu.bu.cs683.traveldroid;

import edu.bu.cs683.traveldroid.data.PointOfInterest;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * This class implements an activity that displays the details of a
 * Point Of Interest to the user.
 */
public class POIDetailActivity extends Activity {

	public static final String INTENT_ACTION_VIEW_POI_DETAIL = "edu.bu.cs683.traveldroid.VIEW_POI_DETAIL";

	private TextView poiName;
	private TextView poiDetail;
	private Button closeButton;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.v(POIDetailActivity.class.getSimpleName(), " onCreate() called");

		//
		TravelDroidApplication application = (TravelDroidApplication) getApplication();
		PointOfInterest currentPoi = application.getSelectedPOI();
		
		this.setContentView(R.layout.poidetaillayout);

		// Set the name and text
		poiName = (TextView) findViewById(R.id.poi_name);
		poiName.setText(currentPoi.getName());
		poiDetail = (TextView) findViewById(R.id.poi_detail);
		poiDetail.setText(currentPoi.getDescription());
		
		// Get a reference to the close button and handle button click
		closeButton = (Button) findViewById(R.id.close_button);
		closeButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                finish();
            }
        });
		
	}

}
